import streamlit as st
import requests
import pdfminer
from pdfminer.high_level import extract_text
import openai
# Set your OpenAI API key
openai.api_key = 'your_openai_api_key'
# Streamlit app
st.title("PDF Summary App")
# Upload PDF file
uploaded_file = st.file_uploader("Upload a PDF file", type="pdf")
if uploaded_file is not None:
# Extract text from the PDF
pdf_text = extract_text(uploaded_file)
# Generate embeddings using OpenAI GPT-3
response = openai.Completion.create(
engine="davinci",
prompt=pdf_text,
max_tokens=200,
n=1,
stop=None,
temperature=0.5,
)
summary = response.choices[0].text.strip()
# Display the summary
st.subheader("Summary:")
st.write(summary)We will be taking the above example, and will create a stramlit app which will use Qdrant and OpenAI embeddings.